<html>
<head><meta charset="utf-8"><title>Reveal::UserFacing and associated types vs const · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html">Reveal::UserFacing and associated types vs const</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="191762322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191762322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191762322">(Mar 25 2020 at 15:23)</a>:</h4>
<p>I think so? we might want to clue in <span class="user-mention" data-user-id="116009">@nikomatsakis</span> just in case this is a mistake :P</p>



<a name="191763083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191763083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191763083">(Mar 25 2020 at 15:27)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/131828-t-compiler/topic/.2368977.3A.20Revert.20.60compute_const.60.20changes.20in.20WF/near/191760589" title="#narrow/stream/131828-t-compiler/topic/.2368977.3A.20Revert.20.60compute_const.60.20changes.20in.20WF/near/191760589">said</a>:</p>
<blockquote>
<p>I never took any care to handle <code>Reveal::UserFacing</code>, because I didn't understand it when it was relevant</p>
</blockquote>
<p>FWIW, the old consteval ignored it completely, so you're not exactly in the wrong here I don't think, and the associated type default reasoning doesn't make much sense to me</p>



<a name="191764514"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191764514" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191764514">(Mar 25 2020 at 15:35)</a>:</h4>
<p>so the only jobs of <code>Reveal::UserFacing</code>, if we ignore associated defaults, would be:</p>
<ol>
<li>keeping "global predicates" (i.e. that don't depend on any type parameters and may look redundant. wait but why would <code>Reveal::All</code> hide those? that sounds like a recipe for ICEs in miri/layout! cc <span class="user-mention" data-user-id="116009">@nikomatsakis</span>)</li>
<li>hide <code>ty::Opaque</code> aka <code>-&gt; impl Trait</code></li>
</ol>



<a name="191781159"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191781159" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191781159">(Mar 25 2020 at 17:17)</a>:</h4>
<p>that reminded me I should try to do this :D <a href="https://github.com/rust-lang/rust/issues/70398" title="https://github.com/rust-lang/rust/issues/70398">#70398</a></p>



<a name="191803547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191803547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191803547">(Mar 25 2020 at 20:00)</a>:</h4>
<p>OK so I've gotten a bunch of pings rom this topic but i've not been able to keep up with it :)</p>



<a name="191803560"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191803560" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191803560">(Mar 25 2020 at 20:00)</a>:</h4>
<p>is there a TL;DR</p>



<a name="191803592"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191803592" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191803592">(Mar 25 2020 at 20:01)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/131828-t-compiler/topic/.2368977.3A.20Revert.20.60compute_const.60.20changes.20in.20WF/near/191764514" title="#narrow/stream/131828-t-compiler/topic/.2368977.3A.20Revert.20.60compute_const.60.20changes.20in.20WF/near/191764514">said</a>:</p>
<blockquote>
<p>so the only jobs of <code>Reveal::UserFacing</code>, if we ignore associated defaults, would be:</p>
<ol>
<li>keeping "global predicates" (i.e. that don't depend on any type parameters and may look redundant. wait but why would <code>Reveal::All</code> hide those? that sounds like a recipe for ICEs in miri/layout! cc <span class="user-mention silent" data-user-id="116009">nikomatsakis</span>)</li>
<li>hide <code>ty::Opaque</code> aka <code>-&gt; impl Trait</code></li>
</ol>
</blockquote>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> is this the TL;DR?</p>



<a name="191803669"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191803669" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191803669">(Mar 25 2020 at 20:01)</a>:</h4>
<p>yeah I guess</p>



<a name="191803749"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191803749" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191803749">(Mar 25 2020 at 20:02)</a>:</h4>
<p>at lease regarding <code>ParamEnv</code></p>



<a name="191803932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191803932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191803932">(Mar 25 2020 at 20:04)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> oh well also the fact that we likely don't want associated <em>const</em> defaults to be treated like associated <em>types</em> in terms of not normalizing during typeck</p>



<a name="191803984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191803984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191803984">(Mar 25 2020 at 20:04)</a>:</h4>
<p>but also I guess I pinged you on this :P <a href="https://github.com/rust-lang/rust/commit/8d98877112d4deb3786de521457418757e010c69#diff-1d1b0d29a2e8da97c6bfb6e364d920c7R1672-R1673" title="https://github.com/rust-lang/rust/commit/8d98877112d4deb3786de521457418757e010c69#diff-1d1b0d29a2e8da97c6bfb6e364d920c7R1672-R1673">https://github.com/rust-lang/rust/commit/8d98877112d4deb3786de521457418757e010c69#diff-1d1b0d29a2e8da97c6bfb6e364d920c7R1672-R1673</a></p>



<a name="191808322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191808322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191808322">(Mar 25 2020 at 20:42)</a>:</h4>
<p>I'm feeling a bit confused :)</p>



<a name="191808329"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191808329" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191808329">(Mar 25 2020 at 20:42)</a>:</h4>
<p>I guess I need to read a bit more of the backscroll</p>



<a name="191808370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191808370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191808370">(Mar 25 2020 at 20:43)</a>:</h4>
<p>In particular, I think I never imagined that reveal-all would have any use <em>besides</em> specialization (associated ty defaults) and impl trait, but maybe I've forgotten something?</p>



<a name="191808378"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191808378" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191808378">(Mar 25 2020 at 20:43)</a>:</h4>
<p>I'm not quite sure what you mean about global predicates, in particular</p>



<a name="191814317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191814317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191814317">(Mar 25 2020 at 21:38)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> <code>UserFacing</code> hides associated type defaults <em>even when</em> we know the entire type so we could just expose the type if we wanted to</p>



<a name="191814347"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191814347" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191814347">(Mar 25 2020 at 21:38)</a>:</h4>
<p>we don't anything like this for <em>values</em>, only <em>types</em></p>



<a name="191814388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191814388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191814388">(Mar 25 2020 at 21:39)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> the global thing is <a href="https://github.com/rust-lang/rust/blob/cdb50c6f2507319f29104a25765bfb79ad53395c/src/librustc/ty/mod.rs#L1840-L1844" title="https://github.com/rust-lang/rust/blob/cdb50c6f2507319f29104a25765bfb79ad53395c/src/librustc/ty/mod.rs#L1840-L1844">https://github.com/rust-lang/rust/blob/cdb50c6f2507319f29104a25765bfb79ad53395c/src/librustc/ty/mod.rs#L1840-L1844</a></p>



<a name="191840192"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191840192" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191840192">(Mar 26 2020 at 04:51)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/131828-t-compiler/topic/.2368977.3A.20Revert.20.60compute_const.60.20changes.20in.20WF/near/191803932" title="#narrow/stream/131828-t-compiler/topic/.2368977.3A.20Revert.20.60compute_const.60.20changes.20in.20WF/near/191803932">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> oh well also the fact that we likely don't want associated <em>const</em> defaults to be treated like associated <em>types</em> in terms of not normalizing during typeck</p>
</blockquote>
<p>Huh? Associated const defaults shouldn't be revealed either in trait defs, e.g. this should result in a unification failure:</p>
<div class="codehilite"><pre><span></span><span class="k">trait</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="n">SIZE</span>: <span class="kt">usize</span> <span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">foo</span><span class="p">(</span><span class="n">x</span>: <span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="n">Self</span>::<span class="n">SIZE</span><span class="p">])</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">_y</span>: <span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="mi">0</span><span class="p">]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">x</span><span class="p">;</span><span class="w"> </span><span class="c1">//~ ERROR mismatched types</span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="191840202"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191840202" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191840202">(Mar 26 2020 at 04:51)</a>:</h4>
<p>This is specced in the associated type defaults RFC</p>



<a name="191843149"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843149" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843149">(Mar 26 2020 at 06:09)</a>:</h4>
<p><span class="user-mention" data-user-id="126931">@centril</span> what I'm talking about is not about trait defs, which have <code>Self</code> in there so clearly it's not known</p>



<a name="191843156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843156">(Mar 26 2020 at 06:09)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> ah; do you have an example in mind wrt. the diff?</p>



<a name="191843201"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843201" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843201">(Mar 26 2020 at 06:10)</a>:</h4>
<p><span class="user-mention" data-user-id="126931">@centril</span> if you have <code>&lt;ConcreteType as Trait&gt;::AssociatedType</code>, type-check won't let you see that if it finds an impl that doesn't specify it and relies on the trait default, IIRC. or maybe it's just with specialization</p>



<a name="191843204"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843204" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843204">(Mar 26 2020 at 06:10)</a>:</h4>
<p>I'll just go make an example</p>



<a name="191843227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843227">(Mar 26 2020 at 06:11)</a>:</h4>
<p><span class="user-mention" data-user-id="126931">@centril</span> <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=8f677687fc5cb72cd2e622047ceb99a6" title="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=8f677687fc5cb72cd2e622047ceb99a6">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=8f677687fc5cb72cd2e622047ceb99a6</a></p>



<a name="191843228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843228">(Mar 26 2020 at 06:11)</a>:</h4>
<p>see the second error</p>



<a name="191843271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843271">(Mar 26 2020 at 06:12)</a>:</h4>
<p>wait what it's gone?! <a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=268803fb5872cd3803025cd27940afab" title="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=268803fb5872cd3803025cd27940afab">https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=268803fb5872cd3803025cd27940afab</a></p>



<a name="191843278"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843278" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843278">(Mar 26 2020 at 06:12)</a>:</h4>
<p>but I could've sworn I've seen that code recently and it looked the same</p>



<a name="191843298"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843298" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843298">(Mar 26 2020 at 06:13)</a>:</h4>
<p>ah, this changed <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_trait_selection/traits/project.rs#L1035" title="https://github.com/rust-lang/rust/blob/master/src/librustc_trait_selection/traits/project.rs#L1035">https://github.com/rust-lang/rust/blob/master/src/librustc_trait_selection/traits/project.rs#L1035</a></p>



<a name="191843341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843341">(Mar 26 2020 at 06:14)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> <a href="https://github.com/rust-lang/rust/pull/64564" title="https://github.com/rust-lang/rust/pull/64564">https://github.com/rust-lang/rust/pull/64564</a> or <a href="https://github.com/rust-lang/rust/pull/61812" title="https://github.com/rust-lang/rust/pull/61812">https://github.com/rust-lang/rust/pull/61812</a> probably changed this, per RFC</p>



<a name="191843346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843346">(Mar 26 2020 at 06:14)</a>:</h4>
<p>likely the latter</p>



<a name="191843351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843351">(Mar 26 2020 at 06:14)</a>:</h4>
<p>it only changed traits specifically, specialization is still affected</p>



<a name="191843352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843352">(Mar 26 2020 at 06:14)</a>:</h4>
<p>while you're at it... you can always finish that RFCs impl :D</p>



<a name="191843367"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843367" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843367">(Mar 26 2020 at 06:15)</a>:</h4>
<p><span class="user-mention" data-user-id="126931">@centril</span> <span class="user-mention" data-user-id="116009">@nikomatsakis</span> <a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=d7ad891485b6404da0520f9ddcd50554" title="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=d7ad891485b6404da0520f9ddcd50554">https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=d7ad891485b6404da0520f9ddcd50554</a></p>



<a name="191843372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843372">(Mar 26 2020 at 06:15)</a>:</h4>
<p>we don't do this for associated consts</p>



<a name="191843429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843429">(Mar 26 2020 at 06:16)</a>:</h4>
<p>that seems like a bug; <code>&lt;() as Trait&gt;::Assoc</code> has a ground term  in <code>Self</code>, so <code>Assoc</code> must be fully known here</p>



<a name="191843446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843446">(Mar 26 2020 at 06:17)</a>:</h4>
<p>no this has been intentional all along</p>



<a name="191843464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843464">(Mar 26 2020 at 06:17)</a>:</h4>
<p>we've relaxed it for defaults coming from the trait itself more recently</p>



<a name="191843476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843476">(Mar 26 2020 at 06:17)</a>:</h4>
<p>but there's long comments in that file about this :P</p>



<a name="191843514"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843514" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843514">(Mar 26 2020 at 06:18)</a>:</h4>
<p>wait what; why is this intentional?</p>



<a name="191843517"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843517" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843517">(Mar 26 2020 at 06:18)</a>:</h4>
<p>ask <span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="191843535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843535">(Mar 26 2020 at 06:19)</a>:</h4>
<p>uh oh <a href="https://github.com/rust-lang/rust/commit/a323ff2c864801fdc8e044e88f11efb49a565ed1#diff-b50d9bf9e9d008c91a87602713a20333L1057-R1057" title="https://github.com/rust-lang/rust/commit/a323ff2c864801fdc8e044e88f11efb49a565ed1#diff-b50d9bf9e9d008c91a87602713a20333L1057-R1057">https://github.com/rust-lang/rust/commit/a323ff2c864801fdc8e044e88f11efb49a565ed1#diff-b50d9bf9e9d008c91a87602713a20333L1057-R1057</a></p>



<a name="191843545"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843545" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843545">(Mar 26 2020 at 06:19)</a>:</h4>
<p><span class="user-mention" data-user-id="211727">@Jonas Schievink</span> ^^ there's a comment above your change there, and probably  elsewhere in the file too</p>



<a name="191843591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843591">(Mar 26 2020 at 06:20)</a>:</h4>
<p>I'm not sure they're 100% correct anymore</p>



<a name="191843680"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843680" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843680">(Mar 26 2020 at 06:22)</a>:</h4>
<p><span class="user-mention" data-user-id="126931">@centril</span> <a href="https://github.com/rust-lang/rust/blob/master/src/librustc/traits/mod.rs#L37-L56" title="https://github.com/rust-lang/rust/blob/master/src/librustc/traits/mod.rs#L37-L56">https://github.com/rust-lang/rust/blob/master/src/librustc/traits/mod.rs#L37-L56</a></p>



<a name="191843745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843745">(Mar 26 2020 at 06:24)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> yea but your playground has a crucial difference: <code>impl Trait for () {}</code>, which locks in the associated type, making it not further specializable</p>



<a name="191843752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843752">(Mar 26 2020 at 06:24)</a>:</h4>
<p>read what I just linked?</p>



<a name="191843755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843755">(Mar 26 2020 at 06:24)</a>:</h4>
<p>I did yes</p>



<a name="191843758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843758">(Mar 26 2020 at 06:25)</a>:</h4>
<p>"However, we <em>could</em> allow projections in fully-monomorphic cases. We choose not to,"</p>



<a name="191843766"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843766" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843766">(Mar 26 2020 at 06:25)</a>:</h4>
<p>my example is a "fully monomorphic case"</p>



<a name="191843782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843782">(Mar 26 2020 at 06:25)</a>:</h4>
<p>Yes, I'm skeptical that comment is the right thing in the case of <code>impl Trait for () {}</code></p>



<a name="191843792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843792">(Mar 26 2020 at 06:25)</a>:</h4>
<p>at least</p>



<a name="191843794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843794">(Mar 26 2020 at 06:25)</a>:</h4>
<p>oh their example is missing that haha</p>



<a name="191843834"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843834" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843834">(Mar 26 2020 at 06:26)</a>:</h4>
<p>that <code>impl</code> doesn't actually matter for the specialization example, it's a left-over from the trait example</p>



<a name="191843841"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843841" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843841">(Mar 26 2020 at 06:26)</a>:</h4>
<p>specializing empty impls do nothing</p>



<a name="191843854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191843854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191843854">(Mar 26 2020 at 06:26)</a>:</h4>
<p>it's only relevant if it actually overrides the default itself <a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=c9cef05e1013f9a04142578724cbf53d" title="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=c9cef05e1013f9a04142578724cbf53d">https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=c9cef05e1013f9a04142578724cbf53d</a></p>



<a name="191844042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191844042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191844042">(Mar 26 2020 at 06:30)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> looks like the impl has inconsistencies then; cause omitting an associated type without further marking it as <code>default</code> does have the effect of locking in the type, per <a href="https://github.com/rust-lang/rust/pull/64564" title="https://github.com/rust-lang/rust/pull/64564">https://github.com/rust-lang/rust/pull/64564</a></p>



<a name="191844053"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191844053" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191844053">(Mar 26 2020 at 06:31)</a>:</h4>
<p><span class="user-mention" data-user-id="211727">@Jonas Schievink</span> yeah, this part here of "is implicitly default" should've been adjusted <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_trait_selection/traits/project.rs#L1019-L1020" title="https://github.com/rust-lang/rust/blob/master/src/librustc_trait_selection/traits/project.rs#L1019-L1020">https://github.com/rust-lang/rust/blob/master/src/librustc_trait_selection/traits/project.rs#L1019-L1020</a></p>



<a name="191844137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191844137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191844137">(Mar 26 2020 at 06:32)</a>:</h4>
<p><span class="user-mention" data-user-id="126931">@centril</span> you're saying there's a required chain of <code>default</code>s now?</p>



<a name="191844146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191844146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191844146">(Mar 26 2020 at 06:33)</a>:</h4>
<p>let me cook up an example</p>



<a name="191844208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191844208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191844208">(Mar 26 2020 at 06:34)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span>  <a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=f211bc5670f7a50631fdfbff832afbba" title="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=f211bc5670f7a50631fdfbff832afbba">https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=f211bc5670f7a50631fdfbff832afbba</a></p>



<a name="191844210"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191844210" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191844210">(Mar 26 2020 at 06:34)</a>:</h4>
<p>the implementation basically remains conservative, with small exceptions</p>



<a name="191844307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191844307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191844307">(Mar 26 2020 at 06:36)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span>  I'd recommend going over Jonas's two PRs (esp. the tests) and reading over the RFC</p>



<a name="191844315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191844315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191844315">(Mar 26 2020 at 06:37)</a>:</h4>
<p><span class="user-mention" data-user-id="126931">@centril</span> I don't think the specialization graph was updated for this</p>



<a name="191844330"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191844330" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191844330">(Mar 26 2020 at 06:37)</a>:</h4>
<p>yea, the impl was partial</p>



<a name="191844340"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191844340" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191844340">(Mar 26 2020 at 06:37)</a>:</h4>
<p>to take advantage of this knowledge you need two trait/impl's, not just one</p>



<a name="191844346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191844346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191844346">(Mar 26 2020 at 06:37)</a>:</h4>
<p>the defaulter and the finalizer</p>



<a name="191844350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191844350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191844350">(Mar 26 2020 at 06:37)</a>:</h4>
<p>when they're equal, it's a non-default</p>



<a name="191844401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191844401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191844401">(Mar 26 2020 at 06:38)</a>:</h4>
<p>when not, and the finalizer isn't missing, you actually can treat something declared as <code>default</code>, as if it weren't</p>



<a name="191844413"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191844413" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191844413">(Mar 26 2020 at 06:39)</a>:</h4>
<p>but you need to tell apart the presence of the <code>finalizer</code>, which the current implementation just doesn't have a way to do, <em>except</em> when the default is from the trait</p>



<a name="191844422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191844422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191844422">(Mar 26 2020 at 06:39)</a>:</h4>
<p>because there's clearly a finalizer otherwise you wouldn't have matched the trait</p>



<a name="191844486"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191844486" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191844486">(Mar 26 2020 at 06:40)</a>:</h4>
<p>none of this would simplify the implementation, at least, and you'd still have cases where even miri/codegen can't normalize something because it hits the blanket impl with a <code>default type</code> or <code>default const</code> and has no finalizer</p>



<a name="191844493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191844493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191844493">(Mar 26 2020 at 06:40)</a>:</h4>
<p>so e.g. it wouldn't help with <span class="user-mention" data-user-id="116107">@davidtwco</span>'s polymorphization struggles</p>



<a name="191844598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191844598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191844598">(Mar 26 2020 at 06:43)</a>:</h4>
<p>uh oh, just realized <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_ty/instance.rs#L90-L100" title="https://github.com/rust-lang/rust/blob/master/src/librustc_ty/instance.rs#L90-L100">https://github.com/rust-lang/rust/blob/master/src/librustc_ty/instance.rs#L90-L100</a> is missing this entire logic <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_trait_selection/traits/project.rs#L1018-L1042" title="https://github.com/rust-lang/rust/blob/master/src/librustc_trait_selection/traits/project.rs#L1018-L1042">https://github.com/rust-lang/rust/blob/master/src/librustc_trait_selection/traits/project.rs#L1018-L1042</a></p>



<a name="191844678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191844678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191844678">(Mar 26 2020 at 06:45)</a>:</h4>
<p>I'm glad we would be able to ship associated type defaults without finalizing the specialization interactions :P</p>



<a name="191844755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191844755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191844755">(Mar 26 2020 at 06:47)</a>:</h4>
<p>is this unnecessary? I can't trigger the bad behavior I expected to on playground <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_trait_selection/traits/project.rs#L1041" title="https://github.com/rust-lang/rust/blob/master/src/librustc_trait_selection/traits/project.rs#L1041">https://github.com/rust-lang/rust/blob/master/src/librustc_trait_selection/traits/project.rs#L1041</a></p>



<a name="191844833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191844833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191844833">(Mar 26 2020 at 06:48)</a>:</h4>
<p><del>ah nvm we use <code>Reveal::All</code> so I can't have generics which means... yeah nvm lol</del></p>



<a name="191844852"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191844852" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191844852">(Mar 26 2020 at 06:48)</a>:</h4>
<p><del>it doesn't matter how correct <code>instance::resolve_associated_item</code> is, since it's never used with <code>UserFacing</code></del></p>



<a name="191844870"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191844870" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191844870">(Mar 26 2020 at 06:49)</a>:</h4>
<p><del>except by WF I guess?</del></p>



<a name="191844932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191844932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191844932">(Mar 26 2020 at 06:50)</a>:</h4>
<p>argh, no, the defaultness condition is first, which means it would override <code>Reveal</code></p>



<a name="191845090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191845090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191845090">(Mar 26 2020 at 06:54)</a>:</h4>
<p><span class="user-mention" data-user-id="125250">@Wesley Wiser</span> why does this not constant fold? I was hoping to show a bad optimization :(<br>
but I can't because it doesn't actually do what I want it to <a href="https://play.rust-lang.org/?version=nightly&amp;mode=release&amp;edition=2018&amp;gist=d247d1ea11675ed855171a239cac7517" title="https://play.rust-lang.org/?version=nightly&amp;mode=release&amp;edition=2018&amp;gist=d247d1ea11675ed855171a239cac7517">https://play.rust-lang.org/?version=nightly&amp;mode=release&amp;edition=2018&amp;gist=d247d1ea11675ed855171a239cac7517</a></p>



<a name="191845094"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191845094" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191845094">(Mar 26 2020 at 06:55)</a>:</h4>
<p>maybe I can trick miri into evaluating something</p>



<a name="191846673"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191846673" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191846673">(Mar 26 2020 at 07:26)</a>:</h4>
<p>meh opened <a href="https://github.com/rust-lang/rust/issues/70419" title="https://github.com/rust-lang/rust/issues/70419">#70419</a>, I don't want to care about this further</p>



<a name="191947573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191947573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191947573">(Mar 26 2020 at 20:55)</a>:</h4>
<p>Hmm so I think that <a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=0e2e556402333111a989fbd40f90b029" title="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=0e2e556402333111a989fbd40f90b029">this example</a> should get an error on the <code>u8</code> case, but not <code>()</code> -- that meets your expectations, <span class="user-mention" data-user-id="126931">@centril</span> ?</p>
<div class="codehilite"><pre><span></span><span class="k">trait</span><span class="w"> </span><span class="n">Trait</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Assoc</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Trait</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">T</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">default</span> <span class="k">type</span><span class="w"> </span><span class="n">Assoc</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kt">bool</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="w"> </span><span class="n">Trait</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="p">()</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">X</span>: <span class="nc">Trait</span><span class="o">&lt;</span><span class="n">Assoc</span><span class="o">=</span><span class="kt">bool</span><span class="o">&gt;&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">foo</span>::<span class="o">&lt;</span><span class="kt">u8</span><span class="o">&gt;</span><span class="p">();</span><span class="w"> </span><span class="c1">//~ ERROR</span>
<span class="w">    </span><span class="n">foo</span>::<span class="o">&lt;</span><span class="p">()</span><span class="o">&gt;</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>


<p>that is not, however, the current behavior, it's true.</p>



<a name="191947692"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191947692" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191947692">(Mar 26 2020 at 20:56)</a>:</h4>
<p>I don't think this is covered by <a href="https://github.com/rust-lang/rust/issues/70419" title="https://github.com/rust-lang/rust/issues/70419">#70419</a></p>



<a name="191947914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191947914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191947914">(Mar 26 2020 at 20:58)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I think that does meet them, but I haven't though deeply about it (slept too little today to do so now anyways <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span>)</p>



<a name="191947971"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191947971" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191947971">(Mar 26 2020 at 20:59)</a>:</h4>
<p>Basic rationale being that <code>for ()</code> has locked in the associated type</p>



<a name="191947994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191947994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191947994">(Mar 26 2020 at 20:59)</a>:</h4>
<p>so further specialization doesn't apply</p>



<a name="191948643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Reveal%3A%3AUserFacing%20and%20associated%20types%20vs%20const/near/191948643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Reveal.3A.3AUserFacing.20and.20associated.20types.20vs.20const.html#191948643">(Mar 26 2020 at 21:04)</a>:</h4>
<p>Filed <a href="https://github.com/rust-lang/rust/issues/70442" title="https://github.com/rust-lang/rust/issues/70442">https://github.com/rust-lang/rust/issues/70442</a> to cover that particuar bug</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>